package com.sxhuayuan.parking.entity;

import com.sxhuayuan.parking.config.CarActType;
import com.sxhuayuan.parking.config.Platform;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 完整出场记录，一进一出，中间有多次缴费记录在支付订单中
 */
@Entity
@Table(name = "hypk_parking_in_out", indexes = { @Index(columnList = "uniqueId") })
public class ParkingInOut extends BaseEntity {

	private static final long serialVersionUID = -2053065861806725403L;

	private String carPlate;

	private String cardNo;

	private Date inTime;

	private Date outTime;

	/** 入场唯一标识，全局唯一，和入场记录中的uniqueId一致 */
	private Long uniqueId;

	/** 第三方入场编号 */
	private String lotRecordId;

	/** 入口id */
	private Long entranceId;
	/** 出口id */
	private Long exitId;

	// 车场id
	private Long parkingLotId;

	// 实缴金额
	private BigDecimal money;

	// 支付类别
	private Platform platform;

	// 车辆操作类型 临时 长期/包月 免费
	private CarActType carActType;

	@Column(length = 32, nullable = false)
	public String getCarPlate() {
		return carPlate;
	}

	public void setCarPlate(String carPlate) {
		this.carPlate = carPlate;
	}

	@Column(length = 32)
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	@Column(nullable = false)
	public Date getInTime() {
		return inTime;
	}

	public void setInTime(Date inTime) {
		this.inTime = inTime;
	}

	@Column(nullable = false)
	public Date getOutTime() {
		return outTime;
	}

	public void setOutTime(Date outTime) {
		this.outTime = outTime;
	}

	public Long getExitId() {
		return exitId;
	}

	public void setExitId(Long exitId) {
		this.exitId = exitId;
	}

	public Long getEntranceId() {
		return entranceId;
	}

	public void setEntranceId(Long entranceId) {
		this.entranceId = entranceId;
	}

	@Column(nullable = false)
	public Long getParkingLotId() {
		return parkingLotId;
	}

	public void setParkingLotId(Long parkingLotId) {
		this.parkingLotId = parkingLotId;
	}

	@Column(nullable = false)
	public Long getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(Long uniqueId) {
		this.uniqueId = uniqueId;
	}

	@Column(length = 64)
	public String getLotRecordId() {
		return lotRecordId;
	}

	public void setLotRecordId(String lotRecordId) {
		this.lotRecordId = lotRecordId;
	}

	public BigDecimal getMoney() {
		return money;
	}

	public void setMoney(BigDecimal money) {
		this.money = money;
	}

	public Platform getPlatform() {
		return platform;
	}

	public void setPlatform(Platform platform) {
		this.platform = platform;
	}

	public CarActType getCarActType() {
		return carActType;
	}

	public void setCarActType(CarActType carActType) {
		this.carActType = carActType;
	}

	/**
	 * 获取字符串形式的uniqueId 前端在接收long型的值时会自进位
	 */
	@Transient
	public String getStrUniqueId() {
		return uniqueId.toString();
	}
}